package com.example.test_event_and_callback.impl;

import com.example.test_event_and_callback.infras.async.ano.AsyncDataDemander;
import com.example.test_event_and_callback.infras.async.Demander;
import com.example.test_event_and_callback.infras.async.MethodCallType;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;

@Getter
@Setter
@AsyncDataDemander(MethodCallType.DIRECT_CALL)
public class TestAsyncDto extends Demander{
    public String id;
    public String name;
    public String text;
    public String address;
    public String nickname;
    public String father;
    public String mother;
    public String culture;

//    @Override
    protected Map<String, Consumer<Object>> initMap() {
        Map<String,Consumer<Object>> map = new HashMap<>();
        map.put("id",(result) -> setId((String) result));
        map.put("name",(result) -> setName((String) result));
        map.put("text",(result) -> setText((String) result));
        map.put("address",(result) -> setAddress((String) result));
        map.put("nickname",(result) -> setNickname((String) result));
        map.put("father",(result) -> setFather((String) result));
        map.put("mother",(result) -> setMother((String) result));
        map.put("culture",(result) -> setCulture((String) result));
        return map;
    }

    @Override
    public String toString() {
        return "TestAsyncDto{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", text='" + text + '\'' +
                ", address='" + address + '\'' +
                ", nickname='" + nickname + '\'' +
                ", father='" + father + '\'' +
                ", mother='" + mother + '\'' +
                ", culture='" + culture + '\'' +
                '}';
    }
}
